<?php
//Funcion que muestra los productos que contiene el carrito
function imprime_carrito($carrito)
{
  if(!$carrito->vacio())
  {
      $suma = 0;
      $cont = 1; 
      ?>
      <table class="tablaDatos" width="100%">
		<tr>
      <th>&#8470;</td>
		<th>Cod.</td>
		<th>Prod.</td>
		<th>Cant.</td>
		<th>Desc.</td>
		<th>Precio venta unit.</td>
		<th>Subtotal</td>
      <th>Acciones</td>
		</tr>
      <?php
      for($i = 0; $i < $carrito->getnum_producto(); $i++)
      {
         if($carrito->getcod_prod($i) != -1 && $carrito->getcantidad($i) > 0 )
         {
           
            $url = $_SERVER["PHP_SELF"] . '?linea=' . $i;
            ?>
		      <tr class="modo1">
            <td><?php echo $cont ?></td>
            <td><?php echo $carrito->getcod_prod($i) ?></td>
		      <td><?php echo $carrito->getnombre_prod($i) ?></td>
		      <td><?php echo $carrito->getcantidad($i) ?></td>
		      <td><?php echo $carrito->getdescuento($i) . "%" ?></td>
		      <td><?php echo "$" . number_format($carrito->getprecio_venta($i),0,",",".") ?></td>
		      <td><?php echo "$" . number_format($carrito->getneto($i),0,",",".") ?></td>
		      <td><a href="<?php echo $url ?>"><img src="<?php echo $_SESSION['BASE'] . '/img/remove.png' ?>" border="0"></td>
		      </tr>
            <?php
		      $suma += $carrito->getneto($i);
            $cont++;
	      }
	   }
      ?>
      
      <!-- Neto -->
	   <tr class="modo1">
	   <td><b>NETO:</b></td>
		<td><b><?php echo '$' . number_format(round($suma),0,",",".") ?></b></td>
		<td>&nbsp;</td>
		</tr>
		<!-- IVA -->
	   <tr class="modo1">
		<td><b>IVA (19%):</b></td>
		<td><b><?php echo '$' . number_format(round($suma * 0.19),0,",",".") ?> </b></td>
		<td>&nbsp;</td>
		</tr>
      <!-- Total -->
	   <tr class="modo1">
	   <td><b>TOTAL:</b></td>
		<td><b><?php echo '$' . number_format(round($suma * 1.19),0,",",".") ?></b></td>
		<td>&nbsp;</td>
		</tr>
	   </table>
      <?php
    }
    else
    {
      echo "No ha ingresado productos.";
    }
}

?>
